﻿@using PagedList.Mvc
@model PagedList.IPagedList<CubicFWNet.Data.ViewModal.StorageTableView>
@{
    ViewBag.Title = "入库记录";
    var start = ViewBag.Start;
    var end = ViewBag.End;
    var name = ViewBag.Name;


}

<section class="content-header">
    <h1>
        入库记录
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index","Home")">首页</a></li>
        <li class="active">入库记录</li>
    </ol>
</section>

<section class="content">
    <div class="form-horizontal">
        <div class="box box-solid">
            <div class="box-nav clearfix">
                <form action="@Url.Action("PutInStorageRecord", "StorageTable")" method="post">
                    <div class="col-sm-12">
                        <div class="form-group col-sm-4">
                            <label class="col-sm-4 control-label no-padding-right" for=""> 名称 </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="Name" name="Name" value="@ViewBag.Name" />
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label class="col-sm-4 control-label no-padding-right" for=""> 开始时间 </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control datepicker" id="Start" name="Start" value="@ViewBag.Start" />
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-4">
                            <label class="col-sm-4 control-label no-padding-right" for=""> 截至时间 </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control datepicker" id="End" name="End" value="@ViewBag.End" />
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <div class="col-sm-8 col-sm-offset-4">
                                <button type="submit" class="btn btn-primary">查询</button>
                                <a class="btn btn-default" href="@Url.Action("DownloadPutInStorageRecord",new {  type = 1 })" title="导出">导出</a>
                                <a class="btn btn-default" onclick="javascript: window.location.reload();" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="box-body">
                <table class="footable table table-stripped table-bordered table-hover" id="footable" data-page-size="20" data-filter=#filter>
                    <thead>
                        <tr>
                            <th data-sort-ignore="true">
                                编码
                            </th>
                            <th data-sort-ignore="true">
                                名称
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                宽*长(mm)
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                规格
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                订单号
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                价格
                            </th>

                            @*<th data-hide="phone,tablet" data-sort-ignore="true">
            类型
        </th>*@

                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                入库数量
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                总库存量
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                基本单位
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                库房
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                入库时间
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                入库人
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                备注
                            </th>

                        </tr>
                    </thead>
                    <tbody>
                        @if (null != Model)
                        {
                            foreach (var item in Model)
                            {
                        <tr>
                            <td>
                                @item.Number
                            </td>
                            <td>
                                <span onclick="ShowModal('@item.ProductId')" name="ProName" id="ProName" class="linkLayout">@Html.DisplayFor(modelItem => item.ProductName)</span>
                            </td>
                            <td>
                                @item.Width * @item.Length
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Format)
                            </td>

                            @*<td>
            @if (item.Type == 1)
            {
                <span class="btn-xs bg-green">成品</span>
            }
            else
            {
                <span class="btn-xs bg-green">原材</span>
            }
        </td>*@
                            <td>
                                @Html.DisplayFor(modelItem => item.OrderNumber)
                            </td>
                            <td>
                                @item.Price.ToString("#0.0000")
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Amount)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Total)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Unit)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.StorageName)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.CreateTime)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.CreatorName)
                            </td>
                            <td>
                                <span>@item.Memo</span>
                            </td>
                        </tr>
                            }
                        }
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="7">
                                每页 @Model.PageSize 条记录，共 @Model.PageCount 页，当前第 @Model.PageNumber 页
                                @Html.PagedListPager(Model, page => Url.Action("PutInStorageRecord", new { page, start, end, name }))
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</section>

<!--查询对话框-->


@section Scripts {
    <script>
        $(document).ready(function () {
            $('#footable').footable();
        });

        //日期控件
        $(".datepicker").datepicker({
            autoclose: true,
            language: 'zh', //汉化
            format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
            minView: "month",//选择日期后，不会再跳转去选择时分秒
        })


        //弹窗显示产品信息
        function ShowModal(id) {

            var options = {
                id: null,
                title: '产品信息',
                width: "90%",
                height: "90%",
                url: "../Product/Info?PID=" + id,
                shade: 0.3,
                btn: ['返回'],
                btnclass: ['btn btn-danger'],
                callBack: null
            }
            $.modalOpen(options);

        }
    </script>
}